home *** CD-ROM | disk | FTP | other *** search
- Path: ctsc.hkbc.hk!not-for-mail
- From: c2155197@Comp.HKBU.Edu.HK (Lin Pang Kui Michael)
- Newsgroups: comp.lang.c
- Subject: Help!READ() in UNIX socket
- Date: 21 Mar 1996 16:50:06 GMT
- Organization: Hong Kong Baptist University
- Message-ID: <4is1bu$1aat@ctsc.hkbc.hk>
- NNTP-Posting-Host: pistis.comp.hkbu.edu.hk
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- hi all,
- i m currently writing a client server application in Linux. Part of my
- server program is shown as below :
- __________________________________________________________________________
- :
- :
- n = read(sockfd,buff,BUFFSIZE);
- if (n == 0) return
- else if (n <0) {
- printf("error.....");
- close_socket(sockfd);
- :
- :
- ---------------------------------------------------------------------------
- My server program works well except that when the client program
- suddenly "die" (e.g. break by CTRL-C).
- When the read() returns -1 , my server program will print the "error.."
- message and then it will be terminated by sth like "segment
- fault"!! How can I trap this system call error so that my server program
- could run continuously ??
-
-
- Thanks in advance !!
-
- Michael
-
-